CONTENTS | INDEX | PREV | NEXT
 PlaceRexxCommand

 FUNCTION
 Send a command to ARexx (DICE)

 SYNTAX
 #include <lib/rexx.h>
 rc = PlaceRexxCommand(port, str, &res, &ec)
 struct MsgPort *port;
 char *str;
 char *res;
 long ec;

 DESCRIPTION
 PlaceRexxCommand sends an ARexx command off to ARexx. (compare to
 PlaceRexxCommandDirect which talks to an application) The command is
 normally a script file to run.  You must specify the ARexx port that
 is to act as the default host port for the command or NULL to use
 DICE's default port. The default extension for the script is always
 the RexxHostName variable.  Note that if you specify NULL for the
 port to use DICE's default, then you must have previously setup
 DICE's default port.  This occurs automatically if RexxHostName was
 declared non-NULL, or manually if you had called
 Create[Global]DiceRexxPort(NULL, "name").

 You supply the command in str which is passed to ARexx as  Arg0.
 Currently there is no support for additional arguments.  DICE will
 run the command synchronously and return the result code.

 The result string pointer will be set to either NULL or a malloc()'d
 string.  If not NULL you are responsible for free()ing the result
 string when you are through with it!!  If you wish to ignore any
 result you may pass NULL for this argument.

 The ec longword will be set to an internal ARexx error code... if the
 returned result code is non-zero and ec == 1 then ARexx was unable to
 find the specified ARexx command.  You may pass NULL for this
 argument if you do not care about the error code.

 It is possible that your program will receive ARexx commands while it
 is waiting for the command you have sent to be returned.  DICE will
 automatically call DoRexxCommand() from within the PlaceRexxCommand()
 routine when this case occurs.

 ARexx will set the error-code ec, which is different from the
 result-code.  ec is set to 1 if the script could not be found. ARexx
 normally returns a severity code of 5 for this case.  If the return
 code is 0 then ec will be 0.

 INPUTS
 struct MsgPort *port;
             Message port for processing.  Typically you pass
             NULL to use the default port.

 char *str;      String to be passed to ARexx for execution

 char **res;     Pointer to place to store result string from
             ARexx.  NULL indicates no result is desired.

 long *ec;       Pointer to place to store error code from ARexx.
             Set to 1 for script not found.  NULL indicates no
             result code desired.

 RESULTS
 int rc;         Return code from ARexx